package com.usian.behavior.controller.v1;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.usian.apis.behavior.ApUnlikeBehaviorControllerApi;
import com.usian.behavior.service.ApUnlikesBehaviorService;
import com.usian.model.behavior.pojos.ApUnlikesBehavior;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/unlikes_behavior")

public class ApUnlikeBehaviorController implements ApUnlikeBehaviorControllerApi {


    @Autowired
    private ApUnlikesBehaviorService apUnlikesBehaviorService;

    @Override
    @GetMapping("one")
    public ApUnlikesBehavior queryUnlikeByEntryIdAndArticleId(
            @RequestParam Integer entryId,@RequestParam Long articleId) {

        LambdaQueryWrapper<ApUnlikesBehavior> behaviorLambdaQueryWrapper =
                Wrappers.<ApUnlikesBehavior>lambdaQuery().eq(ApUnlikesBehavior::getEntryId, entryId).eq(ApUnlikesBehavior::getArticleId, articleId);
        return apUnlikesBehaviorService.getOne(behaviorLambdaQueryWrapper);
    }
}
